package io;

import com.sun.xml.internal.ws.policy.privateutil.PolicyUtils;

import java.io.*;

public class CopyDemo3 {
    public static void main(String[] args)  {
        long ag = System.currentTimeMillis();
        try( FileInputStream fis = new FileInputStream("ideaIU-2021.1.3.exe");
             FileOutputStream fos = new FileOutputStream("copy2.exe");
             BufferedInputStream bis = new BufferedInputStream(fis);
             BufferedOutputStream bos = new BufferedOutputStream(fos)
        ){
            int b;
            while ((b = bis.read())!=-1) {
                bos.write(b);
            }
            long lg = System.currentTimeMillis();
            System.out.println("耗时"+(lg-ag)+"ms");
        } catch (Exception e) {
            e.printStackTrace();
        }

    }
}
